# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def getMinimumDifference(self, root) :
        self.pre = 999
        self.diff = 999
        def find(root):
            if root == None:
                return
            find(root.left)
            self.diff = min(self.diff,abs(self.pre-root.val))
            self.pre = root.val
            find(root.right)
        find(root)
        return self.diff
